﻿using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.Logging;
using NLog.Web;

namespace Magic.Core;

/// <summary>
/// NLog配置
/// </summary>
public static class NLogWebApplicationBuilderExtensions
{
    public static WebApplicationBuilder AddNLog(this WebApplicationBuilder builder) {
        //可加载自定义配置文件
        //LogManager.Setup().LoadConfigurationFromFile("nlog.config");
        builder.Logging.ClearProviders();
        builder.Logging.SetMinimumLevel(LogLevel.Trace);
        builder.WebHost.UseNLog();
        return builder;
    }
}
